﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string userTezt = textBox1.Text;
            string passWord = textBox2.Text;
            var sql = string.Format("select * from Users where Username='{0}' and Password='{1}'", userTezt,passWord);
            var a = DbHelper.Operate1(sql);

            if (a !=0)
            {
                MainForm mainForm = new MainForm();
                this.Hide();
                mainForm.Show();
               
            }
            else
            {
                MessageBox.Show("账号或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            registerForm registerForm = new registerForm();
            registerForm.Show();
        }
    }
}
